///sdse_action InputServer

#ifndef INPUTSERVER_H
#define INPUTSERVER_H

#include "gfxServer.h"
#include "system/action.h"

using namespace sde;

class InputServer : public Action, public Ogre::WindowEventListener, public OIS::KeyListener, public OIS::MouseListener, public OIS::JoyStickListener {
private:
    GfxServer* gfxServer;
    
    CEGUI::System* guiSystem;
    
    OIS::InputManager* inputManager;
    OIS::Keyboard* keyboard;
    OIS::Mouse* mouse;
    OIS::JoyStick* joystick;
    
    CEGUI::MouseButton convertButton(OIS::MouseButtonID buttonID);
    
public:
    InputServer(std::string _type, std::string _name, Object* _object);
    ~InputServer();
    
    void windowResized(Ogre::RenderWindow* rw);
    void windowClosed(Ogre::RenderWindow* rw);
    void update(VarMap args);
    
    bool keyPressed(const OIS::KeyEvent& evt);
    bool keyReleased(const OIS::KeyEvent& evt);
    
    bool mouseMoved(const OIS::MouseEvent& evt);
    bool mousePressed(const OIS::MouseEvent& evt, OIS::MouseButtonID button);
    bool mouseReleased(const OIS::MouseEvent& evt, OIS::MouseButtonID button);
    
    bool buttonPressed(const OIS::JoyStickEvent& evt, int button);
    bool buttonReleased(const OIS::JoyStickEvent& evt, int button);
    bool axisMoved(const OIS::JoyStickEvent& evt, int axis);
};

#endif
